<!--


Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->

<div id="purgeFormContainer" ng-click="$event.stopPropagation()">
    <form id="purgeForm" name="purgeForm" role="form" ng-submit="confirmPurgeJobCreate(newPurgeJobData);" novalidate>
        <div class="row">
            <div class="col-sm-12 col-md-12">
                <div class="form-group" ng-class="{'has-error': hasError(purgeForm.regex), 'has-feedback': hasError(purgeForm.regex)}">
                    <label for="regex" class="control-label">Content pattern (regex) to match:</label>
                    <input id="regex" name="regex" type="text" class="form-control" placeholder="eg. /path/to/content/.*\.jpg" ng-model="newPurgeJobData.regex" ng-pattern="/^\//" autofocus required>
                    <small class="input-error" ng-show="hasPropertyError(purgeForm.regex, 'pattern')">Must Start with /</small>
                    <small class="input-error" ng-show="hasPropertyError(purgeForm.regex, 'required')">Required</small>
                    <span ng-show="hasError(purgeForm.regex)" class="form-control-feedback"><i class="fa fa-times"></i></span>
                </div>
            </div>
        </div>
        <button class="btn btn-block action-btn" ng-disabled="purgeForm.$invalid">Invalidate Content</button>
    </form>
    <hr>
    <h6 id="purgeJobsLoading">My purge jobs for {{deliveryService.displayName}} <i class="fa fa-spin fa-spinner fa-fw" ng-show="loadingPurgeJobs"></i></h6>
    <div id="purgeJobs" ng-show="!loadingPurgeJobs">
        <div class="list-group">
            <li class="list-group-item" ng-repeat="purgeJob in purgeJobs">
                <span>{{purgeJob.assetUrl}}</span>
                <br>
                <span class="purge-job-start">{{dateFormat(toDate(purgeJob.startTime), "mmm d yyyy h:MM TT (Z)")}}</span>
            </li>
        </div>
        <div class="no-picks-alert alert alert-info" ng-show="purgeJobs.length == 0">
            No purge jobs
        </div>
    </div>
</div>
